home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 2
/
Gekikoh Dennoh Club Vol. 2 (Japan).7z
/
Gekikoh Dennoh Club Vol. 2 (Japan) (Track 01).bin
/
kowin
/
font
/
fonted31.lzh
/
fed3sub.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-13
|
4KB
|
189 lines
/*/ ******************************************************************* /*/
/*/ /*/
/*/ FONTED3.win version 1 小笠原博之 SPS0783 COR. /*/
/*/ /*/
/*/ ******************************************************************* /*/
#include <stdio.h>
#include <wlib.h>
#include <parts.h>
#include "fed3const.h"
#include "fonted3.h"
#include "fed3mspat.h"
#define mspatset() MS_PATST( 1, Fed3mspat1 )
#define mspat(a) MS_SEL(a)
#define max(a,b) ( (a)>(b) ? (a) : (b) )
#define min(a,b) ( (a)<(b) ? (a) : (b) )
#define BUGY 18
/*/
/* ビットイメージデータをエディット画面に展開する。
/*/
ImgtoEdit()
{
int i,
x,
y;
unsigned short *ptr;
unsigned int a;
SheetClear( EditScreen, &EditClip, 1 );
for( ptr= ImgBuf, y= 0 ; y<BITSIZEY ; y+= DOTSIZEY ){
a= *ptr++;
for( x=0 ; x<BITSIZEX ; x+= DOTSIZEX, a<<=1 ){
if( !(a & 32768) ){
SheetLine( EditScreen, &EditClip, x, y,
x+(DOTSIZEX-2), y+(DOTSIZEY-2), 0, OptionFill );
}
}
}
}
static
areabox( x1, y1, x2, y2, wp )
int x1,
y1,
x2,
y2;
WindowID wp;
{
DrawBuf buf[1];
DrawSetLine( buf, x1*DOTSIZEX+EDITOFFX+3, y1*DOTSIZEY+EDITOFFY+3,
x2*DOTSIZEX+EDITOFFX+3, y2*DOTSIZEY+EDITOFFY+3, 1|OptionXor,
(x1==x2 || y1==y2) ? OptionLine : OptionBox );
WindowDraw( wp, buf, 1 );
}
areamsg( wp, str )
WindowID wp;
char *str;
{
DrawBuf buf[1];
DrawSetSymbol( buf, MSGOFFX, MSGOFFY, str ? str : " ", AttrDefault, 12 );
WindowDraw( wp, buf, 1 );
}
static
AreaSelectsub( area, wp )
struct Area *area;
WindowID wp;
{
for(;;){
int bx,
by;
int x1,
y1,
x2,
y2;
int flag;
mspatset();
mspat( 1 );
areamsg( wp, "範囲指定中" );
for(;;){
if( WindowGetEventInfo( Ainfo ) && wp == WindowGetChild( WindowRootID, Ainfo ) ){
if( Ainfo->LeftON && Ainfo->x >EDITOFFX &&
Ainfo->x <EDITOFFX+BITSIZEX &&
Ainfo->y >EDITOFFY+BUGY &&
Ainfo->y <EDITOFFY+BITSIZEY+BUGY ){
break;
}else if( Ainfo->RightON ){
areamsg( wp, 0 );
mspat( 0 );
return FALSE;
}
}
}
bx= x1= (Ainfo->x -EDITOFFX)/DOTSIZEX;
by= y1= (Ainfo->y -EDITOFFY-BUGY)/DOTSIZEY;
mspat( 0 );
flag= FALSE;
for(;;){
if( WindowGetEventInfo( Ainfo ) &&
wp == WindowGetChild( WindowRootID, Ainfo ) ){
if( Ainfo->x >EDITOFFX && Ainfo->x <EDITOFFX+BITSIZEX &&
Ainfo->y >EDITOFFY+BUGY && Ainfo->y <EDITOFFY+BITSIZEY+BUGY ){
x2= (Ainfo->x -EDITOFFX)/DOTSIZEX;
y2= (Ainfo->y -EDITOFFY-BUGY)/DOTSIZEY;
if( flag==FALSE || bx!= x2 || by!= y2 ){
if( flag )
areabox( x1, y1, bx, by, wp );
areabox( x1, y1, bx=x2, by=y2, wp );
flag= TRUE;
}
if( Ainfo->LeftON && flag ){
int a;
area->x1= min( x1, x2 );
area->x2= max( x1, x2 );
area->y1= min( y1, y2 );
area->y2= max( y1, y2 );
areamsg( wp, 0 );
return TRUE;
}
}else{
if( flag ){
areabox( x1, y1, bx, by, wp );
flag= FALSE;
}
}
}
if( Ainfo->RightON ){
if( flag )
areabox( x1, y1, bx, by, wp );
break;
}
}
}
}
AreaSelect1( area, wp )
struct Area *area;
WindowID wp;
{
if( AreaSelectsub( area, wp ) ){
areabox( area->x1, area->y1, area->x2, area->y2, wp );
return TRUE;
}
return FALSE;
}
AreaSelect2( area, wp, str )
struct Area *area;
WindowID wp;
char *str; /* 移動先 複写先 */
{
if( AreaSelectsub( area, wp ) ){
areamsg( wp, str );
for( ;; ){
if( WindowGetEventInfo( Ainfo ) && wp == WindowGetChild( WindowRootID, Ainfo ) ){
if( Ainfo->LeftON && Ainfo->x >EDITOFFX &&
Ainfo->x <EDITOFFX+BITSIZEX &&
Ainfo->y >EDITOFFY+BUGY &&
Ainfo->y <EDITOFFY+BITSIZEY+BUGY ){
break;
}else if( Ainfo->RightON ){
areamsg( wp, 0 );
areabox( area->x1, area->y1, area->x2, area->y2, wp );
return FALSE;
}
}
}
area->sx= (Ainfo->x -EDITOFFX)/DOTSIZEX;
area->sy= (Ainfo->y -EDITOFFY-BUGY)/DOTSIZEY;
areabox( area->x1, area->y1, area->x2, area->y2, wp );
areamsg( wp, 0 );
return TRUE;
}
return FALSE;
}